Emulated device firmware testable by native operating system tools

ABSTRACT

Firmware is run in an emulated environment such that firmware is not embedded in its designed-for target device. Target device emulation software communicatively connects the firmware to the operating system in a manner so that communications sent from and received by the operating system are identical to communications that would be sent from and received by the operating system if the firmware were actually embedded in the target device instead of running in the emulated environment.

BACKGROUND OF THE INVENTION

The present invention relates generally to the field of emulated firmware, and more particularly to the testing of emulated firmware.

In the field of computing and electronics, firmware can be described as the “control program” that is used to control electronic or computing devices (that is, “hardware”), in devices where the device's own control program is embedded in the hardware. Firmware is usually stored in non-volatile memory, such as flash memory or ROM (read only memory), and can be described as being semi-permanent, that is, it remains intact unless updated by an outside firmware update program.

In emulation generally, one piece of hardware and/or software imitates, or simulates another piece of hardware and/or software. Firmware emulation is also known. For example, it is useful to use emulation to run the firmware of a flash SSD (solid-state drive) inside of an emulated environment, which allows a greater flexibility of running specific scenarios such as preconditioning wear or error injection. Current methods of emulating a device, or firmware that runs on a device, utilize methods of emulation which run the emulated firmware in a “sandbox” (closed environment). In other words, in an emulated environment, the firmware runs, even though its target device is not present because software emulates all interactions that the firmware would normally have with the target device in which the firmware is designed to be embedded. For purposes of this document, “firmware” shall still be referred to as “firmware” even when it is running in an emulated environment.

Filesystem in Userspace (FUSE) is an operating system mechanism for Unix-like computer operating systems that lets non-privileged users create their own file systems without editing kernel code by running file system code in user space while the FUSE module provides only a kind of “bridge” to the actual interfaces of the kernel computational resources. A commonly used FUSE implementation, is implemented as a loadable kernel module. FUSE is useful for writing virtual file systems. Unlike traditional file systems that essentially save data to and retrieve data from disk, virtual filesystems do not actually store data themselves. Rather, they act as a view or translation of an existing file system or storage device. In principle, any resource available to a FUSE implementation can be exported as a file system.

CUSE (character devices in userspace) is a kernel module for Unix systems that allows character devices, such as USB devices, keyboards, mice, or other devices with serial data transmission from user-space, to create applications. The CUSE module is based on FUSE.

A RAW (sometimes also called “raw”) device is a special kind of block device file that allows accessing a storage device such as a hard disk drive directly, bypassing the operating system's caches and buffers (although hardware caches may still be used). Applications like a database management system can use raw devices directly, enabling the database management system to manage how data is cached, rather than deferring this task to the operating system.

SUMMARY

According to an aspect of the present invention, a computer-implemented method includes the following steps (not necessarily in the following order): (i) running, on a first processor(s) set, an operating system; (ii) emulating, on a second processor(s) set, an emulated environment controlled by target device emulation software; (iii) running, on the second processor(s) set, firmware, designed for a target device, in the emulated environment; and (iv) communicatively connecting, by the target device emulation software, the firmware to the operating system in a manner so that communications sent from and received by the operating system are identical to communications that would be sent from and received by the operating system if the firmware were actually embedded in the target device instead of running in the emulated environment.

According to a further aspect of the present invention, a computer program product runs firmware in an emulated environment. The computer program product includes a computer readable storage medium having program instructions embodied therewith, wherein the computer readable storage medium is not a transitory signal per se. The program instructions executable by a first processor(s) set located in a first computer system cause the first computer system to perform a method including the following steps (not necessarily in the following order): (i) emulating, on the first processor(s) set, an emulated environment controlled by target device emulation software; (ii) running, on the first processor(s) set, the firmware in the emulated environment; and (iii) communicatively connecting the firmware to an operating system, running on a second processor(s) set, in a manner so that communications sent from and received by the operating system are identical to communications that would be sent from and received by the operating system if the firmware were actually embedded in the target device instead of running in the emulated environment.

According to a further aspect of the present invention, a computer system includes a processor, and a computer readable storage medium. The processor is configured to execute program instructions stored on the computer readable storage medium. The computer readable storage medium includes: (i) target device emulation instructions executable by the processor to provide an emulated environment for running firmware designed for a target device in an emulated environment; and (ii) firmware instructions to control a target device when embedded in a target device. The target device emulation instructions include instructions executable by the processor, when the firmware is running in the emulated environment, to communicatively connect the firmware to an operating system in a manner so that communications sent from and received by the operating system are identical to communications that would be sent from and received by the operating system if the firmware were actually embedded in the target device instead of running in the emulated environment.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a schematic view of a first embodiment of a system according to the present invention;

FIG. 2 is a flowchart view showing a first embodiment of a method according to the present invention;

FIG. 3 is a schematic view of a machine logic (for example, software) portion of the first embodiment system;

FIG. 4A is a schematic view of a second embodiment of a system according to the present invention;

FIG. 4B is a screenshot view showing machine readable code used and/or generated by the second embodiment system;

FIG. 4C is another screenshot view showing machine readable code used and/or generated by the second embodiment system;

FIG. 4D is another screenshot view showing machine readable code used and/or generated by the second embodiment system;

FIG. 4E is another screenshot view showing machine readable code used and/or generated by the second embodiment system;

FIG. 5 is a schematic view of a third embodiment of a system according to the present invention;

FIG. 6 is a schematic view of a fourth embodiment of a system according to the present invention;

FIG. 7 is another schematic view of the fourth embodiment system;

FIG. 8 is a schematic view of a fifth embodiment of a system according to the present invention;

FIG. 9 is a flowchart of a second embodiment of a method according to the present invention;

FIG. 10 is a flowchart of a third embodiment of a method according to the present invention;

FIG. 11 is a schematic view of a sixth embodiment of a system according to the present invention; and

FIG. 12 is a flowchart of a fourth embodiment of a method according to the present invention.

DETAILED DESCRIPTION

Some embodiments of the present invention emulate peripheral firmware, such as flash solid state drive, using native operating system tools to test the firmware, such that from an operating system (OS) perspective the peripheral firmware appears as a real physical device. As used herein, the term “native OS tools” means tools which are typically shipped with, or available for the operating system. In some embodiments of the present invention, the user does not have to create his/her own testing tools which “understand” that the device is being emulated. Instead, in these embodiments, the user can simply use existing programs that operate as if they were communicating to a physical plugged-in device of a device type that the existing tools were designed to communicate with. The embodiment(s) of the present invention discussed in detail below use a POSIX-compliant operating system. However, other embodiments of the present invention may be designed for, and applied to, other operating systems (now known or to be developed in the future).

This Detailed Description section is divided into the following sub-sections: (i) The Hardware and Software Environment; (ii) Example Embodiment; (iii) Further Comments and/or Embodiments; and (iv) Definitions.

The present invention may be a system, a method, and/or a computer program product. The computer program product may include a computer readable storage medium (or media) having computer readable program instructions thereon for causing a processor to carry out aspects of the present invention.

The computer readable storage medium can be a tangible device that can retain and store instructions for use by an instruction execution device. The computer readable storage medium may be, for example, but is not limited to, an electronic storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination of the foregoing. A non-exhaustive list of more specific examples of the computer readable storage medium includes the following: a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a static random access memory (SRAM), a portable compact disc read-only memory (CD-ROM), a digital versatile disk (DVD), a memory stick, a floppy disk, a mechanically encoded device such as punch-cards or raised structures in a groove having instructions recorded thereon, and any suitable combination of the foregoing. A computer readable storage medium, as used herein, is not to be construed as being transitory signals per se, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through a waveguide or other transmission media (e.g., light pulses passing through a fiber-optic cable), or electrical signals transmitted through a wire.

Computer readable program instructions described herein can be downloaded to respective computing/processing devices from a computer readable storage medium or to an external computer or external storage device via a network, for example, the Internet, a local area network, a wide area network and/or a wireless network. The network may comprise copper transmission cables, optical transmission fibers, wireless transmission, routers, firewalls, switches, gateway computers and/or edge servers. A network adapter card or network interface in each computing/processing device receives computer readable program instructions from the network and forwards the computer readable program instructions for storage in a computer readable storage medium within the respective computing/processing device.

Computer readable program instructions for carrying out operations of the present invention may be assembler instructions, instruction-set-architecture (ISA) instructions, machine instructions, machine dependent instructions, microcode, firmware instructions, state-setting data, or either source code or object code written in any combination of one or more programming languages, including an object oriented programming language such as Smalltalk, C++ or the like, and conventional procedural programming languages, such as the “C” programming language or similar programming languages. The computer readable program instructions may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the latter scenario, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet Service Provider). In some embodiments, electronic circuitry including, for example, programmable logic circuitry, field-programmable gate arrays (FPGA), or programmable logic arrays (PLA) may execute the computer readable program instructions by utilizing state information of the computer readable program instructions to personalize the electronic circuitry, in order to perform aspects of the present invention.

Aspects of the present invention are described herein with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and/or block diagrams, and combinations of blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer readable program instructions.

These computer readable program instructions may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions/acts specified in the flowchart and/or block diagram block or blocks. These computer readable program instructions may also be stored in a computer readable storage medium that can direct a computer, a programmable data processing apparatus, and/or other devices to function in a particular manner, such that the computer readable storage medium having instructions stored therein comprises an article of manufacture including instructions which implement aspects of the function/act specified in the flowchart and/or block diagram block or blocks.

The computer readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device to cause a series of operations to be performed on the computer, other programmable apparatus or other device to produce a computer implemented process, such that the instructions which execute on the computer, other programmable apparatus, or other device implement the functions/acts specified in the flowchart and/or block diagram block or blocks.

The flowchart and block diagrams in the Figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of instructions, which comprises one or more executable instructions for implementing the specified logical function(s). In some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems that perform the specified functions or acts or carry out combinations of special purpose hardware and computer instructions.

An embodiment of a possible hardware and software environment for software and/or methods according to the present invention will now be described in detail with reference to the Figures. FIG. 1 is a functional block diagram illustrating various portions of computer system 100, including: computer 200; communication unit 202; processor set 204; input/output (I/O) interface set 206; memory device 208; persistent storage device 210; display device 212; external device set 214; random access memory (RAM) devices 230; and cache memory device 232. Some computer programs, shown in FIG. 1 and operating in memory 208 and persistent storage 210 will be identified and discussed in the following sub-section of this Detailed Description section.

Computer 200 is, in many respects, representative of the various computer sub-system(s) in the present invention. Accordingly, several portions of computer 200 will now be discussed in the following paragraphs.

Computer 200 may be a laptop computer, tablet computer, netbook computer, personal computer (PC), a desktop computer, a personal digital assistant (PDA), a smart phone, or any programmable electronic device capable of communicating with the client sub-systems. Computer 200 is capable of communicating with other computer sub-systems, for example, a local area network (LAN), a wide area network (WAN) such as the Internet, or a combination of the two, and can include wired, wireless, or fiber optic connections.

Computer 200 is shown as a block diagram with many double arrows. These double arrows (no separate reference numerals) represent a communications fabric, which provides communications between various components of computer 200. This communications fabric can be implemented with any architecture designed for passing data and/or control information between processors (such as microprocessors, communications and network processors, etc.), system memory, peripheral devices, and any other hardware components within a system. For example, the communications fabric can be implemented, at least in part, with one or more buses.

Memory 208 and persistent storage 210 are computer-readable storage media. In general, memory 208 can include any suitable volatile or non-volatile computer-readable storage media. It is further noted that, now and/or in the near future: (i) external device(s) 214 may be able to supply, some or all, memory for computer 200; and/or (ii) devices external to computer 200 may be able to provide memory for computer 200.

Programs are stored in persistent storage 210 for access and/or execution by one or more of the respective computer processors 204, usually through one or more memories of memory 208. Persistent storage 210: (i) is at least more persistent than a signal in transit; (ii) stores the program (including its soft logic and/or data), on a tangible medium (such as magnetic or optical domains); and (iii) is substantially less persistent than permanent storage. Alternatively, data storage may be more persistent and/or permanent than the type of storage provided by persistent storage 210.

The media used by persistent storage 210 may also be removable. For example, a removable hard drive may be used for persistent storage 210. Other examples include optical and magnetic disks, thumb drives, and smart cards that are inserted into a drive for transfer onto another computer-readable storage medium that is also part of persistent storage 210.

Communications unit 202, in these examples, provides for communications with other data processing systems or devices external to computer 200. In these examples, communications unit 202 includes one or more network interface cards. Communications unit 202 may provide communications through the use of either or both physical and wireless communications links. Any software modules discussed herein may be downloaded to a persistent storage device (such as persistent storage device 210) through a communications unit (such as communications unit 202).

I/O interface set 206 allows for input and output of data with other devices that may be connected locally in data communication with computer 200. For example, I/O interface set 206 provides a connection to external device set 214. External device set 214 will typically include devices such as a keyboard, keypad, a touch screen, and/or some other suitable input device. External device set 214 can also include portable computer-readable storage media such as, for example, thumb drives, portable optical or magnetic disks, and memory cards. Software and data used to practice embodiments of the present invention can be stored on such portable computer-readable storage media. In these embodiments the relevant software may (or may not) be loaded, in whole or in part, onto persistent storage device 210 via I/O interface set 206. I/O interface set 206 also connects in data communication with display device 212.

Display device 212 provides a mechanism to display data to a user and may be, for example, a computer monitor or a smart phone display screen.

The programs described herein are identified based upon the application for which they are implemented in a specific embodiment of the invention. However, it should be appreciated that any particular program nomenclature herein is used merely for convenience, and thus the invention should not be limited to use solely in any specific application identified and/or implied by such nomenclature.

The descriptions of the various embodiments of the present invention have been presented for purposes of illustration, but are not intended to be exhaustive or limited to the embodiments disclosed. Many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the invention. The terminology used herein was chosen to best explain the principles of the embodiment, the practical application or technical improvement over technologies found in the marketplace, or to enable others of ordinary skill in the art to understand the embodiments disclosed herein.

FIG. 2 shows flowchart 250 depicting a set of operations according to the present invention. FIGS. 1 and 3 shows programs 241, 245 (that is, machine logic embodied in hardware or software or both) for controlling at least some of the set of operations of flowchart 250. This set of operations and associated machine logic will now be discussed, over the course of the following paragraphs, with extensive reference to FIG. 2 (for the operation blocks) and FIGS. 1 and 3 (for the machine logic blocks).

More specifically, with respect to the machine logic (for example, software) blocks shown in FIGS. 1 and 3 and used in the operations of flowchart 250 of FIG. 2: (i) operating system program 241 includes memory portion 241 a and persistent storage portion 241 b; (ii) tools A and B 242, 243 are a native part of operating system 241; (iii) tool A 242 includes memory portion 242 a and persistent storage portion 242 b; (iv) tool B 243 includes memory portion 243 a and persistent storage portion 243 b; (v) emulation software 245 includes memory portion 245 a and persistent storage portion 245 b; (vi) emulation software 245 creates an emulation environment 246 in which target firmware 247 runs; (vii) emulation software 245 includes memory portion 245 a and persistent storage portion 245 b; (viii) emulation environment 246 includes memory portion 246 a and persistent storage portion 246 b; and (ix) firmware 247 includes memory portion 247 a and persistent storage portion 247 b. To explain why the various machine logic blocks, discussed in this paragraph have memory portions and persistent storage portion, it is because software programs, as they run, include, create and or manage data that can shift between various forms of storage in a computer system based on factors such as immediate need for a particular piece of data. This is well understood in the art of computer programming generally, and will not be discussed in further discussed here.

Processing begins at operation S255, where operating system program 241 (see FIG. 1) is started up when computer 200 starts up. As is conventional, operating system 241 generally controls operations of computer 200. In order to help control the general operations of computer 200, operating system program 241 includes tool A and tool B, where each too performs a respective function. Example tools and their respective functions will be discussed in more detail in the following sub-section of this Detailed Description section.

Processing proceeds to operation S260, where emulation software 245 sets up emulation environment 246 and runs firmware 247 in the emulation environment. While the firmware is designed to be embedded in a physical device, in this example the firmware is not attached to any physical device because its code is being tested for bugs, possible improvements and the like. Because the running of firmware in an emulation environment is not new, the emulation environment will not be discussed in detail here, except with respect to the aspect of communications between the firmware-under-test and the operating system. Firmware 247 a,b, as it begins to run in emulated environment 246 a,b is shown in both FIGS. 1 and 3.

Processing proceeds to operation S265, where communicative connection module (“mod”) 248 uses its machine logic to set up a communicative connection between firmware 247 a,b and operating system 241 a,b. More specifically, in this example, mod 248 of emulation software 245 a, b communicatively connects firmware 247 a, b to the operating system 241 a, b in a manner so that communications sent from and received by the operating system are identical to communications that would be sent from and received by the operating system if the firmware were actually embedded in the target device instead of running in emulated environment 246 a, b.

Even more specifically: (i) input sub-mod 249 controls communications received from the operating system to the firmware; and (ii) output sub-mod 239 controls communications flowing from the firmware to the operating system.

Processing proceeds to operation S270, where stimulation mod 238 causes operating system 241 to provide host input stimulation to firmware 247. This host input stimulation will be further discussed, below, in the following sub-section of this detailed description section.

Some embodiments of the present invention recognize the following facts, potential problems and/or potential areas for improvement with respect to the current state of the art: (i) methods of emulating a device have little to no interaction with the environment outside of the “sandbox” (closed environment); (ii) methods of emulating firmware that run on a device has little to no interaction with the environment outside of the “sandbox”; and/or (iii) it is difficult or impossible to provide items such as host input/output (I/O) stimulation to the emulated firmware.

Some embodiments of the present invention may include one, or more, of the following features, characteristics and/or advantages: (i) creates a framework which connects emulated flash SSD (solid-state drive) firmware directly to the host operating system; (ii) the host operating system “sees” the emulated flash SSD as a physically attached SSD; (iii) all the operating system tools can be used to stimulate the emulated flash SSD to test the firmware on the SSD; and/or (iv) all the operating system tools can be used to stimulate the emulated flash SSD to exercise the firmware on the SSD.

Some embodiments of the present invention may further include one, or more, of the following features, characteristics and/or advantages: (i) developers don't have to waste time writing stimulation scenarios; (ii) developers can use existing operating system tools; (iii) actual implementations of the flash SSD can be connected to the same host and comparisons made between the actual and emulated SSD; (iv) the same operating system tools that stimulate the emulated flash SSD work on the actual SSD; and/or (v) all tests written for the emulated flash SSD do not have to be rewritten for the actual SSD. Further with regard to item (iii) above, actual implementations of the flash SSD is valuable for defect diagnosis.

Some embodiments of the present invention may further include one, or more, of the following features, characteristics and/or advantages: (i) utilizes libfuse (library file system in user space) that enables a developer to implement a file system in user-space to implement “hooks” between the FUSE library and the emulator; (ii) no kernel-level software is modified; and/or (iii) surpasses other types of emulation methods which require low-level kernel/driver support.

As shown in FIG. 4A, system 400 includes: computational resources 401 (including user computational resources 401 a and kernel computational resources 401 b); emulated flash SSD (solid state drive) 402; flash SSD firmware 404; kernel communication module 406; libfuse (library for file system in user space) 408; libcuse (library for character devices in user space) 410; standard operating system programs set (also sometimes herein referred to as “host operating system”) 412; standard operating system program dd 414 a; standard operating system program cat 414 b; standard operating system program sg3utils 414 c; connection 416; virtual file system 460; and FUSE/CUSE (file system in user space and character devices in user space) 462.

The program dd 414 a is a POSIX program whose primary purpose is to copy a file from one location to another. It has powerful features such as substituting “zero's” or “random” or in fact any POSIX file/pipe for the copy source, target, or both. In general when users of POSIX systems want to do a quick test to detect whether I/O can be performed on a device or file, the user uses program dd 414 a. Program dd 414 a can perform RAW I/O (input/output). In other words, program dd 414 a can perform I/O on any type of device.

Program cat 414 b displays the contents of a file. Program cat 414 b is the POSIX standard way of displaying the contents of a file to the screen.

Program sg3_utils 414 c is a set of utilities available in Linux which allows the user to issue any type of SCSI (small computer system interface) command to a Solid State or Hard Disk Drive. The inclusion of program sg3_utils in this embodiment shows versatility in the type of program to which some embodiments of the present invention may be applicable because program sg3_utils 414 c can emulate both RAW devices as well as Block devices such as a Solid State Drive. This is not possible with conventional emulators that focus on one type of device only.

In system 400, when the emulated flash SSD 402 boots, connection 416 is created to the Linux operating system's libfuse 408 and libcuse 410. (Note: the term(s) “LINUX” may be subject to trademark rights in various jurisdictions throughout the world and are used here only in reference to the products or services properly denominated by the marks to the extent that such trademark rights may exist.) Libfuse 408 allows certain Linux utilities to pass through to the emulator. More specifically, the Linux utilities are utilities that expect to operate on a block device or file system. In this embodiment of the present invention, included as libfuse 408 commands are commands suitable for the following operating system programs: dd 414 a; cat 414 b; and/or sg3_utils 414 c. Libcuse 410 allows certain Linux utilities, which utilities expect to operate on a character device. In this context, ‘character device’ should be understood as an example of a RAW device. “Character device” is what LINUX-compatible RAW devices are typically called in a POSIX environment. Use of a character device allows writing data to the device or read data from the device starting at any address and transferring any amount of data without restriction. The data written to or read from the device does not have to literally correspond to alphanumeric characters.

Examples of libcuse 410 commands are: (i) commands suitable for a SCSI (small computer system interface) generic toolset (such as, the sg3_utils package); and/or (ii) commands for any tool which intends to send IOCTLs (input/output controls) to the flash SSD. Any appropriate commands sent to the libfuse 408 or libcuse 410, through connection 416, are forwarded to the emulated firmware 404 for processing. Any commands sent by the emulated firmware 404 are forwarded through the libfuse 408 or libcuse 410, again through connection 416, back to the operating system.

While this example uses a Linux operating system, and Linux operating system tools, the present invention extends to any operating system running on a kernel and having a FUSE and/or CUSE (or equivalent). These other operating systems include, at least some other POSIX type operating systems besides Linux. In non-POSIX based operating systems (such as Microsoft Windows), existing libraries providing a user space file system implementation (such as the Dokan library) can be used or written to provide the hooks necessary to connect the emulator to the operating system. (Note: the term(s) “MICROSOFT,” “WINDOWS,” “LINUX,” “POSIX,” and/or “DOKAN” may be subject to trademark rights in various jurisdictions throughout the world and are used here only in reference to the products or services properly denominated by the marks to the extent that such trademark rights may exist.)

Commands passed along connection 416 from emulated flash SSD 402 to the standard operating systems program 412 go through the Linux kernel computational resources 401 b and interface with kernel virtual file system 460 and kernel FUSE/CUSE 462. As shown by the curve of communication path 416 in FIG. 4A, commands between the standard operating system programs set (which is in the user space above the dotted line in FIG. 4A) and the emulated flash SSD (which is also in the user space above the dotted line in FIG. 4A) are passed through the kernel space below the dotted line in FIG. 4A.

Screenshot 452 of FIG. 4B shows emulated SSD firmware used in system 400. Screenshot 454 of FIG. 4C shows code associated with a first operating system tool used in system 400. Screenshot 456 of FIG. 4D shows code associated with a second operating system tool used in system 400. On a terminology note, “operating system program” and “operating system tool” are to be considered to have the same meaning in this document. Screenshot 458 of FIG. 4E shows code associated with a third operating system tool used in system 400.

As shown in FIG. 5, system 500 includes: computational resources 501 (including user computational resources 501 a and kernel computational resources 501 b); emulated device 502; kernel communication module 506, libfuse 508; libcuse 510; host operating system 512; standard operating system programs 514 a to 514 c; connection 516; virtual file system 560; and FUSE/CUSE 562.

In system 500, system 400 (described above) has been extended to model other sub-systems. More specifically, instead of emulating a flash SSD (as in system 400), other devices can be emulated in emulated device block 502. These devices include, but are not limited to: (i) a PCI (peripheral component interconnect) ethernet adapter; and/or; (ii) a RAID (redundant array of independent disks) controller card. These devices are represented in system 500 as emulated device 502 and will be described below.

Some embodiments of the present invention may further include one, or more, of the following features, characteristics and/or advantages: (i) can be expanded to emulate multiple components of a system; (ii) can be expanded to emulate an entire system consisting of various different components simultaneously, such as multiple emulated flash SSDs; (iii) can connect multiple emulated components, such as emulated flash SSDs via an operating system standard API (application programming interface), such as a Unix socket; and/or (iv) can emulate a PCI RAID controller adapter and then connect emulated flash SSDs, such as emulated flash SSDs.

As shown in FIG. 6, diagram 600 includes: computational resources 601 (including user computational resources 601 a and kernel computational resources 601 b); emulated flash SSDs 602 a to 602 c; kernel communication module 606; libfuse 608; libcuse 610; host operating system 612; standard operating system programs 614 a to 614 c; connection 616; socket 622; emulated RAID (redundant array of independent disks) controller 620; kernel communication module 626; libfuse 628; libcuse 630; virtual file system 660; and FUSE/CUSE 662.

In system 600, the concepts described above in connection with system 400 and system 500 above are further expanded to emulate: (i) multiple components of a system; and/or (ii) an entire system consisting of various different components simultaneously. More specifically, in system 600, multiple emulated flash SSDs 602 a to 602 c include libfuse 608 and libcuse 610 within kernel communications module 606. Likewise, libfuse 628 and libcuse 630 are included within kernel communications module 626 and are included as part of emulated RAID controller 620. Emulated flash SSDs 602 a to 602 c are connected to and communicate with emulated RAID controller 620 using socket 622.

Emulated flash SSDs 602 a to 602 c are connected and communicate with emulated RAID controller 620 using socket 622. When emulated flash SSDs 602 a to 602 c and/or emulated RAID controller 620 boots, connection 616 is created to the Linux operating system 612. This connection uses libfuse 608 and libcuse 610 included in kernel communication module 606 and/or libfuse 628 and libcuse 630 included in kernel communication module 626. The libfuse connections allow certain Linux utilities to pass through to the emulator. Again, examples of libfuse commands are commands suitable for the following operating system programs such as dd 614 a; cat 614 b; and/or sg3_utils 614 c. Commands sent to the libfuse 608/628 or libcuse 610/630 are forwarded to emulated flash SSDs 602 a to 602 c and/or emulated RAID controller 620 for processing. Any commands sent by emulated flash SSDs 602 a to 602 c and/or emulated RAID controller 620 are forwarded through the libfuse 608/628 or libcuse 610/630 using connection 616 back to the standard operating system program 612. Commands being passed by connection 616 from emulated flash SSDs 602 a to 602 c and/or emulated RAID controller 620 to the standard operating systems program 612 go through the Linux kernel 601 b and interface with kernel virtual file system 660 and kernel FUSE/CUSE 662. These commands are passed from the user 601 a, through the Linux kernel 601 b, and then back to user 601 a using connection 616.

Some embodiments of the present invention may further include one, or more, of the following features, characteristics and/or advantages: (i) emulated devices do not have to be running on the same server; (ii) emulated devices do not have to be running on the same operating system; and/or (iii) one server, such as host server, may be running an emulated RAID controller, connected via Unix sockets, to other multiple servers running emulated flash SSDs.

As shown in FIG. 7, system 700 includes: emulated flash SSDs 702 a to 702 d; emulated RAID controller 720; sockets 722 a to 722 d; host servers 732 a to 732 d; and host server 750. In system 700, host server 750 is shown running emulated RAID controller 720. Host server 750 is connected to and communicates with “other” multiple host servers. More specifically, Unix sockets 722 a to 722 d provide the connection/communication path from host server 750 to host servers 732 a to 732 d respectively. Host servers 732 a to 732 d are each running emulated flash SSDs 702 a to 702 d respectively. System 700 shows that one or more emulated device(s) can run on their own server, which in turn, can be connected and communicate with other host servers.

Some embodiments of the present invention may further include one, or more, of the following features, characteristics and/or advantages: (i) ability to record I/O traces; (ii) ability to playback I/O traces; (iii) recording of traces is user controlled; (iv) playback of traces is user controlled; (v) ability to take an I/O trace from an actual device and play it back into the emulated device, or vice-versa; and/or (vi) aids in debugging. Further with regard to item (vi) above, a user can replay a particular I/O sequence over and over to recreate a particular problem.

As shown in FIG. 8, system 800 includes: emulated flash SSD 802; flash SSD firmware 804; kernel communication module 806; libfuse 808; libcuse 810; I/O recording/playback module 840; and record file 842.

In system 800, emulated flash SSD 802 includes firmware 804. Firmware 804 communicates with and commands I/O recording/playback module 840. Likewise, I/O recording/playback module 840 communicates with libfuse 808 and libcuse 810 included within kernel communication module 806. The operation of I/O recording/playback module 840 is user controlled, and is used to record and/or retrieve I/O traces from record file 842. The I/O data stored on record file 842 may be used by engineers and/or programmers to debug and/or recreate problems.

As shown in FIG. 9, flowchart 900 depicts a method according to the present invention.

Processing begins at operation 902 where recording of the I/O data begins.

Processing continues to operation 904 where the software waits (monitors) for a record I/O operation to act on.

At operation 904 above, once the software has a record I/O operation to act on, processing continues to operation 906 where the software determines if an I/O operation has occurred.

At operation 906 above, if the software determines that an I/O operation has occurred (Yes), processing continues to operation 908 where the software determines if the I/O recording is enabled.

At operation 908 above, if the software determines if the I/O recording is enabled (Yes), processing continues to operation 910 where the software determines if the record file is full.

At operation 910 above, if the software determines the record file in not full (No), processing continues to operation 912 where recording of the I/O data is performed.

At operation 906 above, if the software has determined the I/O operation has not occurred (No), processing continues to operation 914.

At operation 908 above, if the software determines the I/O recording in not enabled (No), processing continues to operation 914.

At operation 910 above, if the software determines the record file is full (Yes), processing continues to operation 914.

At operation 914, the software performs all operations pertaining to recording of the I/O data.

Processing loops back to operation 904 where the software again waits (monitors) for a record I/O operation to act on.

Some embodiments of the present invention may further include one, or more, of the following features, characteristics and/or advantages: (i) all operations identified as “I/O” operations (such as read or write) are saved to a file if recording is “enabled”; and/or (ii) the I/O operations are saved until the record file is “full”. Further with regard to item (ii) above, “full” is defined as being the “maximum file size” or the “number of I/O operations” to record, and is defined by the user.

As shown in FIG. 10, flowchart 1000 depicts a method according to the present invention. Processing begins at operation 1002 where playback of the I/O data file begins.

Processing continues to operation 1004 where the software determines if I/O playback is enabled.

At operation 1004 above, if the software determines the I/O playback is enabled (Yes), processing continues to operation 1006 where the software determines if all I/O data has been read from the file.

At operation 1006 above, if the software determines that not all the I/O data has been read from the file (No), processing continues to operation 1008 where the software retrieves the next I/O data record from the file.

At operation 1004 above, if the software determines the I/O playback is not enabled (No), processing continues to operation 1010.

At operation 1006 above, if the software determines that all of the I/O data has been read from the file (Yes), processing proceeds to operation 1010.

At operation 1010, the software waits (monitors) for a playback I/O operation to act on.

Processing continues to operation 1012 where the software performs all operations pertaining to playback of the I/O data.

Processing loops back to operation 1004 where the software again determines if the playback I/O is enabled.

Some embodiments of the present invention may further include one, or more, of the following features, characteristics and/or advantages: (i) if a valid trace file is fed to the emulator and playback is “enabled”, all I/O contained within the trace file are played back through the emulator; and/or (ii) once all I/O traces are read from the file, playback ceases and the emulator continues to operate in normal mode, handling I/O in a usual manner.

Some embodiments of the present invention may further include one, or more, of the following features, characteristics and/or advantages: (i) ability to save a snapshot of the state of the firmware; (ii) ability to load a snapshot of the state of the firmware; and/or (iii) ability for loading firmware images, in a certain state, into the emulator.

As shown in FIG. 11, system 1100 includes: emulated flash SSD 1102; kernel communication module 1106; libfuse 1108; libcuse 1110; I/O recording/playback module 1140; record file 1142; firmware 1150; firmware state 1152; snapshot module 1154; and snapshot file 1156.

In system 1100, the concept described in FIG. 7, system 700 above is taken to the next level where the ability to save and load a “snapshot” of the firmware state included in the firmware is shown. Emulated flash SSD 1102 includes firmware 1150. Firmware 1150 includes firmware state 1152. Firmware 1150 communicates with and commands I/O recording/playback module 1140. Likewise, I/O recording/playback module 1140 communicates with libfuse 1108 and libcuse 1110 included in kernel communication module 1106. The operation of I/O recording/playback module 1140 is user controlled, and is used to record and/or retrieve I/O traces from record file 1142. Firmware 1150 and firmware state 1152 also communicate with snapshot module 1154. Snapshot module 1154 in turn communicates with snapshot file 1156. Firmware state 1152 is passed through snapshot module 1154 and is stored in snapshot file 1156. Snapshot file 1156 has the ability to save and load the firmware state 1152 into the emulator.

As shown in FIG. 12, flowchart 1200 depicts a method according to the present invention. Processing begins at operation 1202 where loading a snapshot of the firmware state begins.

Processing continues to operation 1204 where the software determines if a snapshot of the firmware state should be loaded.

At operation 1204 above, if the software determines a snapshot of the firmware state is to be loaded (Yes), processing continues to operation 1206 where the software reads the snapshot file.

Processing continues to operation 1208 where the software loads the firmware state into RAM (random access memory).

At operation 1204 above, if the software determines a snapshot of the firmware should not be loaded (No), processing continues to operation 1210.

At operation 1210, the software runs the firmware image.

Processing continues to operation 1214 where the software determines if the snapshot of the firmware image should be saved. If (Yes), processing continues to operation 1216 where the software reads the firmware state from RAM.

Processing continues to operation 1218 where the software saves the snapshot to file.

Processing loops back to operation 1210 where the software again determines whether or not to run the firmware image.

At operation 1214 above, if the software determines the snapshot of the firmware image should not be saved (No), processing loops back to operation 1210 where the software again determines whether or not to run the firmware image.

In some embodiments of the present invention, firmware is emulated by: (i) conventional smart buffers; and/or (ii) some other means.

Some embodiments of the present invention may further include one, or more, of the following features, characteristics and/or advantages after the firmware is emulated: (i) the emulated firmware is connected in data communication (or, “communatively connected”) directly to the operating system; (ii) the operating system “sees” the emulated firmware as a physical disk drive; (iii) the user can use common operating system tools (for example, partition utilities, I/O generators, etc.) instead of writing their own exercising tools from scratch; (iv) multiple heterogeneous components can be emulated (for example, a RAID controller card, and not just a SSD); (v) multiple heterogeneous components, once emulated, can be connected to one another; (vi) emulated components can exist anywhere on any server and can exist on heterogeneous servers. Further with regard to item (i) in the foregoing list, a “shim” is a very small piece of software which acts as a conduit between two other layers of software allowing those two pieces of software to seamlessly communicate, even if they natively could not do so; shim here refers to the fact that the two layers of software don't realize the other side is speaking a different protocol or language. Further with regard to item (v) above, a RAID controller card can be emulated and be connected to several instances of emulated flash SSDs. The emulated RAID controller card then “sees” the SSDs as actual physical SSDs. Further with regard to item (vi) above, the RAID Controller card emulator can run on a Windows machine in a lab environment and connect to multiple flash SSD emulator instances running on a Linux laptop.

Some embodiments of the present invention may further include one, or more, of the following features, characteristics and/or advantages after the firmware is emulated: (i) recording of I/O traces is supported; (ii) playback of I/O traces is supported; (iii) state of the firmware (or the contents of the conventional smart buffers) can be saved into a snapshot file; and/or (iv) state of the firmware (or the contents of the conventional smart buffers) can be re-loaded into new instances.

Further, with regard to items (i) and (ii) in the preceding paragraph, in an extemporary use case, and given an I/O trace from an actual flash SSD, the user can feed the trace into the emulated SSD to recreate a problem scenario. Further, with regard to items (iii) and (iv) in the preceding paragraph, in an extemporary use case, if a defect is encountered the user can snapshot the state and save it. To debug the problem, the state can be re-loaded as many times as necessary, instead of running I/O, to attempt to get it back into the defect state.

Some embodiments of the present invention may further include one, or more, of the following features, characteristics and/or advantages: (i) a way to run the firmware of an HDD (hard disk drive) or SSD (solid state drive) inside of an emulator; (ii) running the firmware of a SSD in an emulated environment such that it appears as a physical SSD to the personal computer's operating system; (iii) does not relate to emulating anything composing the personal computer's operating system; (iv) does not relate to anything dealing with reboots of the personal computer; (v) to further connect the emulated environment of the firmware of a SSD into an operating system in such a way that the operating system “thinks” that the emulated device is a physical device, allowing the developer to exercise the firmware of the physical device using the native operating system tools (also herein referred to as operating system programs); and/or (vi) the developer does not have to write any special APIs (application programming interfaces) or code in order to interact with the emulated device.

Some embodiments of the present invention may further include one, or more, of the following features, characteristics and/or advantages: (i) does not describe any features to utilize any physical devices; (ii) does not cause any physical devices to look like a different type of physical device; (iii) does not require a kernel module; (iv) features occur in a user environment; (v) has an exemplary implementation in the Linux operating system; (vi) is not confined to a single operating system; and/or (vii) ability to run the exact firmware image that exists on the SSD in the emulated environment, in this way, the software developer is testing the firmware image of the SSD.

DEFINITIONS

Present invention: should not be taken as an absolute indication that the subject matter described by the term “present invention” is covered by either the claims as they are filed, or by the claims that may eventually issue after patent prosecution; while the term “present invention” is used to help the reader to get a general feel for which disclosures herein that are believed as maybe being new, this understanding, as indicated by use of the term “present invention,” is tentative and provisional and subject to change over the course of patent prosecution as relevant information is developed and as the claims are potentially amended.

Embodiment: see definition of “present invention” above—similar cautions apply to the term “embodiment.”

and/or: inclusive or; for example, A, B “and/or” C means that at least one of A or B or C is true and applicable.

Module/Sub-Module: any set of hardware, firmware and/or software that operatively works to do some kind of function, without regard to whether the module is: (i) in a single local proximity; (ii) distributed over a wide area; (iii) in a single proximity within a larger piece of software code; (iv) located within a single piece of software code; (v) located in a single storage device, memory or medium; (vi) mechanically connected; (vii) electrically connected; and/or (viii) connected in data communication.

Computer: any device with significant data processing and/or machine readable instruction reading capabilities including, but not limited to: desktop computers, mainframe computers, laptop computers, field-programmable gate array (FPGA) based devices, smart phones, personal digital assistants (PDAs), body-mounted or inserted computers, embedded device style computers, application-specific integrated circuit (ASIC) based devices. 

What is claimed is:
 1. A computer-implemented method comprising: running, on a first processor(s) set, an operating system; emulating, on a second processor(s) set, an emulated environment controlled by target device emulation software; running, on the second processor(s) set, firmware, designed for a target device, in the emulated environment; and communicatively connecting, by the target device emulation software, the firmware to the operating system in a manner so that communications sent from and received by the operating system are identical to communications that would be sent from and received by the operating system if the firmware were actually embedded in the target device instead of running in the emulated environment.
 2. The method of claim 1 wherein the first processor set and the second processor set are the same processor set such that the operating system, the emulated environment and the firmware are running on a single computer.
 3. The method of claim 1 wherein the first processor set and the second processor set are different processor sets, respectively located in two different computers in data communication with each other.
 4. The method of claim 3 wherein: the target device emulation software includes a RAID (redundant array of independent disks) controller; and the communicative connection of the firmware to the operating system is controlled, at least in part, by the RAID controller.
 5. The method of claim 1 further comprising: using, by the firmware running in the emulated environment, a first operating program, which is part of the operating system, to perform a first function.
 6. The method of claim 5 wherein the first function includes at least one of the following: (i) copying a file from one location to another; (ii) display the contents of a file; and/or (iii) issue any type of SCSI (small computer system interface) command to a solid state drive or disk drive.
 7. The method of claim 1 wherein the target device is a non-volatile data storage device.
 8. The method of claim 7 wherein the target device is a solid state drive (SSD).
 9. The method of claim 8 wherein the target device is a flash SSD.
 10. The method of claim 1 further comprising: providing host input/output stimulation between the firmware and the operating system over the communicative connection between the firmware and the operating system.
 11. A computer program product for running firmware in an emulated environment, the computer program product comprising a computer readable storage medium having program instructions embodied therewith, wherein the computer readable storage medium is not a transitory signal per se, the program instructions executable by a first processor(s) set located in a first computer system to cause the first computer system to perform a method comprising: emulating, on the first processor(s) set, an emulated environment controlled by target device emulation software; running, on the first processor(s) set, the firmware in the emulated environment; and communicatively connecting the firmware to an operating system, running on a second processor(s) set, in a manner so that communications sent from and received by the operating system are identical to communications that would be sent from and received by the operating system if the firmware were actually embedded in the target device instead of running in the emulated environment.
 12. The product of claim 11 wherein the program instructions include a RAID controller.
 13. The product of claim 11 wherein the first processor(s) set is the same as the second processor(s) set.
 14. The product of claim 11 wherein: the second processor(s) set is different from the first processor(s) set; and communications sent from and received by the operating system are communicated through a communication network which is part of the first computer system.
 15. The product of claim 11 wherein the communications sent from and received by the first operating system allow the firmware to use a first operating program, which is part of the operating system, to perform a first function.
 16. The product of claim 15 wherein the first function includes at least one of the following: (i) copying a file from one location to another; (ii) display the contents of a file; and/or (iii) issue any type of SCSI (small computer system interface) command to a solid state drive or disk drive.
 17. A computer system comprising: a processor; and a computer readable storage medium; wherein the processor is configured to execute program instructions stored on the computer readable storage medium, the computer readable storage medium comprising: target device emulation instructions executable by the processor to provide an emulated environment for running firmware designed for a target device in an emulated environment; and firmware instructions to control a target device when embedded in a target device; wherein: the target device emulation instructions include instructions executable by the processor, when the firmware is running in the emulated environment, to communicatively connect the firmware to an operating system in a manner so that communications sent from and received by the operating system are identical to communications that would be sent from and received by the operating system if the firmware were actually embedded in the target device instead of running in the emulated environment.
 18. The system of claim 17 wherein the instructions to communicatively connect the firmware to the operating system include a RAID controller.
 19. The system of claim 18 wherein: the processor(s) set includes a first processor(s) sub-set located in a first computer, and a second processor(s) set located in a second computer; the first and second computers communicate over a communication network; the operating system is located, at least substantially, in the first computer; and the RAID controller is located, at least substantially, in the second computer.
 20. The system of claim 17 wherein the target device emulation instructions further include instructions executable by the processor to provide host input/output stimulation between the firmware and the operating system over the communicative connection between the firmware and the operating system. 